import { getInfo, setInfo } from '@/utils/storage'

export default {
  namespaced: true,
  state: {
    userInfo: getInfo()
  },
  mutations: {
    SETUSERINFO (state, userInfo) {
      state.userInfo = userInfo
      // 本地存储
      setInfo(userInfo)
    }
  },
  actions: {
    logout (context) {
      context.commit('SETUSERINFO', {})
      // 跨模块调用root: true
      context.commit('cart/GET_CART_LIST', [], { root: true })
    }
  },
  getters: {
  }
}
